<template>
    <div>
        <ul>
            <div v-for="item in arr" :key="item._id">
                <h3>{{item.productName}}</h3>
                <div v-html="item.productImg"></div>
                <div>价格：{{item.productPrice}}</div>

                <router-link :to="'/detail?id='+item.productId" tag="button">商品详情</router-link>
                <hr>

            </div>
        </ul>
    </div>
</template>

<script>
import {getCategory} from "../api"
export default {
    data(){
        return {
            arr:[]
        }
    },
    mounted(){
        getCategory().then(res=>{
            this.arr = res.data.result
            console.log(this.arr);           
        })
    },

}
</script>
<style >

</style>